﻿using System;
using System.Collections;
using System.Reflection;
using System.Web.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace RHD.Common.Web.Components.Grid {
	public class GridResult : ActionResult {
		public IEnumerable List { get; set; }

		public GridResult(IEnumerable list) {
			this.List = list;
		}

		public override void ExecuteResult(ControllerContext context) {
			string json = JsonConvert.SerializeObject(this.List, new JavaScriptDateTimeConverter());
			context.HttpContext.Response.ContentType = "application/json";
			context.HttpContext.Response.Write(json);
		}
	}
}